<?php
    include('../Lib/php/conex.php');
	$link= conectaSQL("influenza","inf123456","influenza");
	import_request_variables('gP');
	$cadena = explode(" ",$value);
	$sql="select TOP 10 clavecct,(a.n_clavecct+', T.'+
	case a.turno
	when 1 then 'M.'
	when 2 then 'V.' end
	+' ('+b.corto+') '+a.nivel_moda) as 'escuela' from catalogos.dbo.cat_escuelas_sep a
	inner join catalogos.dbo.entidad b on a.id_entidad = b.entidad
	WHERE ";
	for($i=0;$i<count($cadena);$i++){
		$x .= "a.n_clavecct+''+a.nivel_moda LIKE '%".strtoupper($cadena[$i])."%' AND ";
	}
	$x = substr($x,0,-4);
	$sql .= $x." group by clavecct,a.n_clavecct,a.turno,b.corto,b.entidad,a.nivel_moda
	order by b.entidad,a.n_clavecct";
	$select = mssql_query($sql,$link) or die(mssql_get_last_message().$sql);
	$registros = mssql_num_rows($select);
	echo "<ul >";
	if(mssql_num_rows($select) == 0){
		echo "<li style='visibility:collapse'>No hay resultados</li>";
	} else{
		for($a=0;$a<(mssql_num_rows($select));$a++){
			$reg = mssql_fetch_array($select);
			echo "<li >".$reg[1]."</li>";
		}
	}
	echo "</ul>";

?>

